package com.cn.ctrl

import com.cn.dto.Dog
import com.zhiwangyilian.anno.Uinfo
import org.springframework.web.bind.annotation.GetMapping
import org.springframework.web.bind.annotation.PostMapping
import org.springframework.web.bind.annotation.RequestBody
import org.springframework.web.bind.annotation.RequestMapping
import org.springframework.web.bind.annotation.RestController

@RestController
class DogCtrl {
    @PostMapping("a")
    fun add(@RequestBody dog: Dog?): String {
        if (dog != null) {
            return "add Dog ${dog.name} is ${dog.age} years old."
        }
        return "null 5646"
    }

    @GetMapping("b")
    fun b(@Uinfo x: String?): String {
        return "b is $x"
    }
}